package by.grsu.pochebut.entity;


import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import com.epam.grsulab.webapi.entity.base.BaseEntity;

@Entity
public class Car extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	private Long id;

	@Column
	private String model;

	@Column
	private String color;

	@Column
	private Double price;

	@OneToMany(targetEntity = Booking.class, mappedBy = "car", cascade = CascadeType.ALL)
	private List<Booking> book;

	@Column
	private Date data;

	public Date getData() {
		return data;
	}

	public void setData() {
		
	   
		this.data = new java.util.Date();
       
	}

	public List<Booking> getBook() {
		return book;
	}

	public void setBook(List<Booking> book) {
		this.book = book;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	@Override
	public String toString() {

		return this.model.toString();
	}

}
